import request from '@/utils/request'
// 同案类案人设置 API接口
// eslint-disable-next-line camelcase
const crw_rule_samecase_Api = {
  list: '/crw_rule_samecase/list', // 同案类案人设置分页列表
  view: '/crw_rule_samecase/view', // 查看同案类案人设置
  delete: '/crw_rule_samecase/delete', // 删除同案类案人设置
  save: '/crw_rule_samecase/save', // 修改或保存同案类案人设置
  saveRule: '/crw_rule_samecase/saveRule', // 修改或保存同案类案人设置及人员，人员分组信息
  existsRuleName: '/crw_rule_samecase/existsRuleName' // 判断规则名称是否已存在
}

/**
 * 同案类案人设置分页列表
 * @param body
 */
export function samecaseRuleList (body) {
  return request({
    url: crw_rule_samecase_Api.list,
    method: 'post',
    data: body
  })
}

/**
 * 查看同案类案人设置
 * @param id
 */
export function viewSamecaseRule (id) {
  return request({
    url: crw_rule_samecase_Api.view,
    method: 'get',
    params: {
      id
    }
  })
}

/**
 * 删除同案类案人设置
 * @param id
 */
export function deleteSamecaseRule (id) {
  return request({
    url: crw_rule_samecase_Api.delete,
    method: 'post',
    params: {
      id
    }
  })
}

/**
 * 修改或保存同案类案人设置
 * @param body
 */
export function saveSamecaseRule (body) {
  return request({
    url: crw_rule_samecase_Api.save,
    method: 'post',
    data: body
  })
}

/**
 * 修改或保存同案类案人设置及人员，人员分组信息
 * @param body
 * @param personIds
 * @param groupIds
 */
export function saveRuleSetting (body, personIds, groupIds) {
  return request({
    url: crw_rule_samecase_Api.saveRule,
    method: 'post',
    data: body,
    params: {
      personIds,
      groupIds
    }
  })
}

/**
 * 判断地图描述是否已存在
 * @param name
 */
export function existsRuleName (name) {
  return request({
    url: crw_rule_samecase_Api.existsRuleName,
    method: 'get',
    params: {
      name
    }
  })
}
